<!-- Action -->
<!-- Author: Edwin -->
<template>
  <div class=''>
    <el-button type="text"
               size="mini"
               @click.stop="openScheduleDetailsDialog">{{ i18nT('custom.workSchedule.edit') }}</el-button>
    <ScheduleDetailsDialog :addTemplateDialog="addTemplateDialog"
                           :tenantCode="$data.data.tenantCode"
                           :userId="$data.data.userId"
                           :username="$data.data.username"
                           :timezoneFull="$data.data.timezoneFull"
                           :timezoneName="$data.data.timezoneName"
                           :timezoneOffset="$data.data.timezoneOffset"
                           :workScheduleList="$data.data.workScheduleList"
                           :workSchedule="$data.data.workSchedule"
                           :tenantUserId="$data.data.tenantUserId"
                           @closeDialog="closeScheduleDetailsDialog" />
    <!-- 'tenantCode', 'userId', 'username', 'timezoneFull', 'timezoneName', 'timezoneOffset', 'workScheduleList', 'workSchedule', 'tenantUserId' -->
  </div>
</template>

<script>
import ScheduleDetailsDialog from './schedule-details'
import i18n from '@/i18n'

export default {
  components: { ScheduleDetailsDialog },
  data () {
    return {
      addTemplateDialog: false,
      scheduleDetailsInfo: null
    }
  },
  methods: {
    i18nT (key) {
      return i18n.t(key)
    },
    // editSchedule (e) {
    //   this.$emit('openScheduleDetailsDialog', this.$data.data)
    // },
    openScheduleDetailsDialog () {
      // this.$refs['add-template'].show()

      this.scheduleDetailsInfo = this.$data.data
      this.addTemplateDialog = true
      // this.$parent.getScheduleList()
    },
    closeScheduleDetailsDialog () {
      this.scheduleDetailsInfo = null
      this.addTemplateDialog = false
    }
  }
}
</script>

<style scoped>
</style>
